package com.hu.chat.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hu.chat.config.WebInterceptor;
import com.hu.chat.mapper.GroupUserMapper;
import com.hu.chat.model.base.GroupUser;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class GroupUserService extends ServiceImpl<GroupUserMapper, GroupUser> {

    public List<Integer> getUserIdListByGroupId(Integer id) {
        List<GroupUser> groupUserList = baseMapper.selectList(new LambdaQueryWrapper<GroupUser>().eq(GroupUser::getGroupId, id));
        return groupUserList.stream()
                .map(GroupUser::getUserId)
                .collect(Collectors.toList());
    }
}


